<!--  -->
<template>
  <div>
    <!-- 添加购物 -->
    <van-goods-action>
      <van-goods-action-icon :icon="isCollected?'star':'star-o'"
                             :text="isCollected?'已收藏':'未收藏'"
                             color="#ff5000"
                             @click="isCollected=!isCollected" />
      <van-goods-action-icon icon="cart-o"
                             text="购物车"
                             :badge="goodsCount" />
      <van-goods-action-button type="danger"
                               text="立即购买"
                               @click="handleBuy" />
      <van-goods-action-button type="warning"
                               text="加入购物车"
                               @click="goToCart" />

    </van-goods-action>
  </div>
</template>

<script>
export default {
  data () {
    return {
      isCollected: false,
    }
  },
  props: ['goodsCount'],
  methods: {
    handleBuy () {
      return this.$toast("功能未开发")
    },
    goToCart () {
      return this.$emit("goToCart");
    }
  },
  //生命周期 - 创建完成（访问当前this实例）
  created () {

  },
  //生命周期 - 挂载完成（访问DOM元素）
  mounted () {

  }
}
</script>
<style scoped>
.van-goods-action {
  z-index: 9000;
}
</style>